// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the DLLWINDOW_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// DLLWINDOW_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.

#ifndef _VIDEOWINDOW_H_
#define _VIDEOWINDOW_H_

#include <jthread.h>
#include <jmutex.h>
#include <miprawvideomessage.h>

namespace librtp_video{

// This class is exported from the dllwindow.dll
class VideoWindow : public JThread {

private:
	uint64_t m_sourceID;

	HWND m_hwnd;

	int m_width;
	int m_height;

	bool m_resize;

	JMutex m_frameMutex;
	uint8_t *m_pImgData;
	uint8_t *m_pDrawBuffer;
	uint32_t *m_pBitArray;

protected:
	LRESULT onTimer(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

	BOOL createWindow();

public:
	VideoWindow(void);
	~VideoWindow();

	uint64_t getSourceID(){ return m_sourceID; }
	void setSourceID(uint64_t id){ m_sourceID = id; }

	virtual void* Thread();

	LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

	void destroyWindow();

	void setWindowStyle(LONG style);
	LONG getWindowStyle();

	void setParent(HWND parent);

	void processRawVideoMessage(MIPRawYUV420PVideoMessage *pMsg);

};

}

#endif //_VIDEOWINDOW_H_

